import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";

// 基于 qiankun 的微前端主应用的改造
import { registerMicroApps, start } from "qiankun";
import actions from "./actions/token";

registerMicroApps([
  {
    name: "vue2", // 微应用名称
    entry: "//localhost:8080", // 微应用服务器地址
    container: "#vue2", // 微应用将来要渲染到这个容器内
    activeRule: "/vue2", // 当地址匹配上activeRule，该微应用就会加载渲染
    props: {
      // 主应用和微应用的通信
      actions,
    },
  },
  {
    name: "vue3",
    entry: "//localhost:8081",
    container: "#vue3",
    activeRule: "/vue3",
    props: {
      actions,
    },
  },
  {
    name: "vue3-vite",
    entry: "//localhost:5174",
    container: "#vue3-vite",
    activeRule: "/vue3-vite",
    props: {
      actions,
    },
  },
]);
// 启动 qiankun
start();

createApp(App).use(router).mount("#app");
